package org.xtext.runtime.formula;

import java.util.Map;
import java.util.Set;

import org.xtext.runtime.term.Variable;
import org.xtext.runtime.util.Bindings;
import org.xtext.runtime.util.ILogicVisitor;

public class CartagoProperty implements IFormula {
	Predicate formula;
	
	public CartagoProperty(Predicate formula) {
		this.formula = formula;
	}

	@Override
	public IFormula copy() {
		return new CartagoProperty(formula.copy());
	}

	@Override
	public Set<Variable> variables() {
		return formula.variables();
	}

	@Override
	public CartagoProperty apply(Bindings bindings) {
//		System.out.println("about to apply: " + bindings + " to: " + this);
		return new CartagoProperty(formula.apply(bindings));
	}

	@Override
	public IFormula copy(Map<String, Variable> vars) {
		return new CartagoProperty(formula.copy(vars));
	}

	@Override
	public boolean hasFreeVariables() {
		return formula.hasFreeVariables();
	}

	@Override
	public Object accept(ILogicVisitor visitor) {
		return visitor.visit(this);
	}

	public Predicate getFormula() {
		return formula;
	}

}
